<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>冒泡排序</title>
		<script>
			var arr = [10, 7, 5, 27, 98, 31];
			for (var i = 1; i < arr.length; i++) {
				for (var j = 0; j < arr.length - i; j++) { 
					if (arr[j] > arr[j + 1]) { 
						var temp = arr[j + 1];
						arr[j + 1] = arr[j];
						arr[j] = temp;
					}
				}
			}
			console.log(arr); 
		</script>
	</head>
	<body>
		<h1>冒泡排序</h1>
	</body>
</html>
